﻿//********************************************************************************//
//创建日期：<创建日期，2016-06-7>
//创建作者：<郭登杰>
//功能说明：审批详情-户藉
//********************************************************************************//
using DevExpress.Web;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using Platform.Http;
using Web.Class;
using Platform.Common;
using System.Text;

namespace Web.Controls.LAIHAN
{
    public partial class UCLHLCSHENPIXX_HUJI : System.Web.UI.UserControl, IUCLHOperate
    {
        #region 属性

        /// <summary>
        /// 来函类型
        /// </summary>
        public eLaiHanLX LaiHanLX
        {
            get;
            set;
        }

        /// <summary>
        /// 来函流程
        /// </summary>
        public eLaiHanLCBH LaiHanLC { get; set; }

        #endregion

        #region 变更

        private SpHelper _sphelper = new SpHelper();

        #endregion

        #region 事件

        /// <summary>
        /// 加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
        }

        #endregion

        #region 方法

        /// <summary>
        /// 配置控件
        /// </summary>
        public void InitControl()
        {
            if ((int)this.LaiHanLX > 20)
            {
                this.tdZR.InnerText = "取水科科长";
                this.trJSK.Visible = false;
            }
            else
            {
                this.tdZR.InnerText = "主任";
                this.trJSK.Visible = true;
            }
        }

        /// <summary>
        /// 提交验证
        /// </summary>
        /// <returns></returns>
        public ValidateRS Validate()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 清除信息
        /// </summary>
        public void ClearInfo()
        {

        }

        /// <summary>
        /// 根据来函加载信息
        /// </summary>
        /// <param name="laihanxx">来函信息</param>
        public void LoadInfo(YS_LH_LAIHANXX laihanxx)
        {
            DataRowCollection drc = this._sphelper.P_YS_LHGETSHENPIYJS((int)this.LaiHanLX, laihanxx.S_LAIHANBH).Tables[0].Rows;
            List<int> indexes = LaiHanLCTools.GetNeedRowIndexs(drc, (int)laihanxx.I_LAIHANLX, eLaiHanLCBH.业务员);
            if (indexes.Count > 0)
            {
                this.txtYWY.Text = Convert.ToString(drc[indexes[0]]["S_SHENPIYJ"]);
            }
            indexes = LaiHanLCTools.GetNeedRowIndexs(drc, (int)laihanxx.I_LAIHANLX, eLaiHanLCBH.主任);
            if (indexes.Count > 0)
            {
                this.lblZR.Text = Convert.ToString(drc[indexes[0]]["S_SHENPIYJ"]);
                this.cbTYZR.Checked = Convert.ToInt32(drc[indexes[0]]["I_SHENPIJG"]) == 1;
                this.cbBTYZR.Checked = !this.cbTYZR.Checked;
            }
            indexes = LaiHanLCTools.GetNeedRowIndexs(drc, (int)laihanxx.I_LAIHANLX, eLaiHanLCBH.节水科);
            if (indexes.Count > 0)
            {
                this.lblJSK.Text = Convert.ToString(drc[indexes[0]]["S_SHENPIYJ"]);
                this.cbTYJSK.Checked = Convert.ToInt32(drc[indexes[0]]["I_SHENPIJG"]) == 1;
                this.cbBTYJSK.Checked = !this.cbTYJSK.Checked;
            }
            indexes = LaiHanLCTools.GetNeedRowIndexs(drc, (int)laihanxx.I_LAIHANLX, eLaiHanLCBH.计财科);
            if (indexes.Count > 0)
            {
                this.lblJCK.Text = Convert.ToString(drc[indexes[0]]["S_SHENPIYJ"]);
                this.cbTYJCK.Checked = Convert.ToInt32(drc[indexes[0]]["I_SHENPIJG"]) == 1;
                this.cbBTYJCK.Checked = !this.cbTYJCK.Checked;
            }
            indexes = LaiHanLCTools.GetNeedRowIndexs(drc, (int)laihanxx.I_LAIHANLX, eLaiHanLCBH.处长);
            if (indexes.Count > 0)
            {
                this.lblCZ.Text = Convert.ToString(drc[indexes[0]]["S_SHENPIYJ"]);
                this.cbTYCZ.Checked = Convert.ToInt32(drc[indexes[0]]["I_SHENPIJG"]) == 1;
                this.cbBTYCZ.Checked = !this.cbTYCZ.Checked;
            }
        }

        #endregion
    }
}